import 'package:taonile/generated/json/base/json_field.dart';
import 'package:taonile/generated/json/product_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class ProductEntity {

	late int code=0;
	late String msg;
	late List<ProductData> data=[];
  
  ProductEntity();

  factory ProductEntity.fromJson(Map<String, dynamic> json) => $ProductEntityFromJson(json);

  Map<String, dynamic> toJson() => $ProductEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ProductData {

	late String id;
	@JSONField(name: "main_img")
	late String mainImg;
	late String name;
	late String price;
	late String sort;
	@JSONField(name: "sales_num")
	late String salesNum;
	@JSONField(name: "area_id")
	late String areaId;
	late String integral;
	@JSONField(name: "store_id")
	late String storeId;
	late ProductDataStore store;
	late String func;
	@JSONField(name: "allow_pay_str")
	late String allowPayStr;
	late String money;
	late String money1;
	late String company;
	late String company1;
  
  ProductData();

  factory ProductData.fromJson(Map<String, dynamic> json) => $ProductDataFromJson(json);

  Map<String, dynamic> toJson() => $ProductDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ProductDataStore {

	late String id;
	late String name;
	late String logo;
  
  ProductDataStore();

  factory ProductDataStore.fromJson(Map<String, dynamic> json) => $ProductDataStoreFromJson(json);

  Map<String, dynamic> toJson() => $ProductDataStoreToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}